//
//  BaseCollectionViewCell.m
//  ManBetX
//
//  Created by Cocoa on 2020/4/20.
//  Copyright © 2020 Fullen. All rights reserved.
//

#import "BaseCollectionViewCell.h"

@implementation BaseCollectionViewCell

- (void)configure:(id)entity {
    
    self.entity = entity;
}

/**
 *  自动返回cell的identifierId格式为【xib名称+Id】
 *
 *  @return 格式为【xib名称+Id】(如：XXXViewCellId)
 */
+(NSString *) getCollectionViewCellIdentifier {
    
    return [NSString stringWithFormat:@"%@Id",[[self class] getClassString]];
}


+ (void)registerToCollectionView:(UICollectionView *)collectionView; {
    
    [collectionView registerNib:[UINib nibWithNibName:[[self class] getClassString] bundle:nil] forCellWithReuseIdentifier:[[self class] getCollectionViewCellIdentifier]];
}

+ (NSString *)getClassString {
    NSString *tempString = NSStringFromClass([self class]);
    NSArray *stringArray = [tempString componentsSeparatedByString:@"."];
    if (stringArray.count>0) {
        return [NSString stringWithFormat:@"%@",stringArray.lastObject];
    }
    return [NSString stringWithFormat:@"%@",tempString];
}

@end
